home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCommon / Include / FWPriMem.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  2.6 KB  |  70 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPriMem.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPRIMEM_H
  11. #define FWPRIMEM_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #include <stddef.h>
  18.  
  19. #if FW_LIB_EXPORT_PRAGMAS
  20. #pragma lib_export on
  21. #endif
  22.  
  23. //----------------------------------------------------------------------------------------
  24. // Primitive Memory Operations
  25. //
  26. //    These functions provide a platform-independent interface to low level operating
  27. //    system services for memory management.  The functions impose minimal requirements
  28. //    on the underlying environment, and are built in the simplest way on top of native
  29. //    operating system APIs.  Requirements for parameter validation and error handling
  30. //    are minimal: it is the clients responsiblity to provide valid parameters!
  31. //
  32. //    Memory blocks allocated and freed by these functions can be as large as can be
  33. //    requested with a size_t parameter, but these routines should generally not be
  34. //    used for large allocations.
  35. //
  36. //    This function are intended for use by very low-level code.  Applications, Component
  37. //    Editors (and most of ODF) should use higher level interfaces.
  38. //
  39. //----------------------------------------------------------------------------------------
  40.  
  41. FW_FUNC_ATTR void * FW_PrimitiveAllocateBlock(size_t bytesRequested);
  42.     // Operation is undefined for bytesRequested == 0
  43.     // Operation is also undefined if a signed negative value is passed in for bytesRequested.
  44.     // Returns 0 if request could not be satisfied due to insufficient memory.
  45.     
  46. FW_FUNC_ATTR void * FW_PrimitiveResizeBlock(void *block, size_t bytesRequested);
  47.     // The block may be moved to satisfy request.
  48.     // Returns 0 if request could not be satisfied.
  49.     // Resize of NULL or invalid block is undefined (platform-dependent).
  50.     
  51. void FW_FUNC_ATTR FW_PrimitiveFreeBlock(void *block);
  52.     // Free of invalid block is undefined (platform-dependent).
  53.     // It is a no-op to try to free NULL.
  54.  
  55. size_t FW_FUNC_ATTR FW_PrimitiveGetBlockSize(void* p);
  56.     // Returns size in bytes.
  57.     // Size of NULL or invalid block is undefined (platform-dependent).
  58.  
  59. void FW_FUNC_ATTR FW_PrimitiveCopyMemory(const void *source, void *destination, size_t bytes);
  60.     // Copy from source to destination.
  61.     // Source and destination may be overlapping.
  62.     // No error detection provided, i.e. it is assumed that both the source and destination 
  63.     // buffers are at least 'bytes' long.
  64.  
  65. #if FW_LIB_EXPORT_PRAGMAS
  66. #pragma lib_export off
  67. #endif
  68.  
  69. #endif
  70.